public class main {
       static  volatile  boolean flg = false;
    public static void main(String[] args) throws InterruptedException {
            Thread tq  =new Thread(() ->{
               int i = 0;
               while (!flg){
                   i++ ;
               }
                System.out.println(i);

            });
            tq.start();
            Thread.sleep(100);
            flg=true;
    }
}
